package com.hunk.core.auth.repository;

import java.util.List;

import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import com.hunk.core.auth.entity.User;

/**
 * Description :<br>
 *  Data Access Object Interface
 * @author HunkDeng
 * @since 2013-4-27
 */
@Repository
public interface UserRepository extends JpaRepository<User, String>, JpaSpecificationExecutor<User> {
	public abstract User findByUsername(String username);
	public abstract List<User> findByUsernameAndRealname(String username,String realname);
	
	public final static Sort defaultSort = new Sort(new Sort.Order(Direction.ASC, "username"), new Sort.Order(Direction.ASC, "realname"));
}
